package cn.jiyun.classes.controller;

import cn.jiyun.classes.pojo.AdchannelVo;
import cn.jiyun.classes.pojo.ClassesDto;
import cn.jiyun.classes.pojo.Dto;
import cn.jiyun.classes.service.ClassesService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/classes")
@CrossOrigin(allowedHeaders = "*")
@Slf4j
public class ClassesController {
    @Autowired
    private ClassesService classesService;
    @PostMapping("/findPage")
    public Page findPage(@RequestBody ClassesDto classesDto){
        return classesService.findPage(classesDto);
    }
    @DeleteMapping("/{id}")
    public AdchannelVo delete(@PathVariable("id")Integer id){
        return classesService.delete(id);
    }
    @PostMapping("/deletebyis")
    public AdchannelVo deletebyis(@RequestBody Integer[] ids){
        return classesService.deletebyis(ids);
    }
    @PostMapping("/add")
    public AdchannelVo add(@RequestBody Dto dto){
        return classesService.add(dto);
    }
    @RequestMapping("/{id}")
    public Dto findById(@PathVariable("id")Integer id){
        return classesService.findById(id);
    }
    @RequestMapping("/edit")
    public AdchannelVo edit(@RequestBody Dto dto){
        return classesService.edit(dto);
    }
}
